package io.github.lee.core.util

import android.content.Context


fun Number.toDp(context: Context): Int {
    val density = context.resources.displayMetrics.density
    return (this.toFloat() / density + 0.5F).toInt()
}

fun Number.toPx(context: Context): Int {
    val density = context.resources.displayMetrics.density
    return (this.toFloat() * density + 0.5F).toInt()
}

